package com.open.rbac.model.vo.sys;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;

import com.open.rbac.constant.MenuType;
import com.open.rbac.model.vo.sys.group.MenuUpdate;

/**
 * 菜单参数
 *
 * @author Riche's
 * @since 2022/8/18
 */
@Schema(name = "MenuVo", description = "菜单参数")
@Getter
@Setter
public class MenuVo {

    @Schema(description = "菜单ID")
    @NotBlank(message = "菜单ID为必填项", groups = MenuUpdate.class)
    @Length(min = 1, max = 36, message = "菜单ID长度在 1~36 之间", groups = MenuUpdate.class)
    private String id;

    @Schema(description = "父菜单ID")
    @Length(max = 36, message = "父菜单ID长度在 1~36 之间")
    private String parentId = "0";

    @Schema(description = "菜单名称")
    @NotBlank(message = "菜单名称为必填项")
    @Length(min = 2, max = 32, message = "菜单名称长度在 2~32 之间")
    private String name;

    @Schema(description = "前端路由名称")
    private String routerName;

    @Schema(description = "前端路由路径")
    private String routerPath;

    @Schema(description = "前端路由的组件路径：/views/**/*.vue|.tsx")
    private String routerComponent;

    @Schema(description = "菜单图标")
    @Length(max = 255, message = "菜单图标最长不超过255个字符")
    private String icon;

    @Schema(description = "请求方法: GET/POST/PUT/DELETE/PATCH")
    @Length(max = 10, message = "请求方法最长不超过10个字符")
    private String method;

    @Schema(description = "菜单URL")
    @Length(max = 255, message = "请求方法最长不超过255个字符")
    private String url;

    @Schema(description = "菜单类型")
    @NotNull(message = "菜单类型为必填项")
    private MenuType type;

    @Schema(description = "菜单排序")
    private Integer sort;

    @Schema(description = "权限标识")
    private String authKey;

    @Schema(description = "是否已启用：0-否，1-是")
    private Boolean enable;

    @Schema(description = "备注")
    @Size(max = 255, message = "备注最长不能超过255个字符")
    private String remark;

}
